omit-empty
Recursively omit empty properties from an object. Omits empty objects, arrays, strings or zero.
Install
Install with npm:
$ npm install omit-empty --save
Usage
var omitEmpty = require('omit-empty');
omitEmpty({a: 'a', b: ''});
omitEmpty({a: 'a', b: {c: 'c', d: ''}});
omitEmpty({a: ['a'], b: []});
omitEmpty({a: 0, b: 1});
omitEmpty({a: 0, b: 1}, true);
Related projects
You might also be interested in these projects:
- for-in: Iterate over the own and inherited enumerable properties of an objecte, and return an object… more | homepage
- for-own: Iterate over the own enumerable properties of an object, and return an object with properties… more | homepage
- is-plain-object: Returns true if an object was created by the
Object
constructor. | homepage - reduce-object: Reduces an object to a value that is the accumulated result of running each property… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert.
Released under the MIT license.
This file was generated by verb, v0.9.0, on April 09, 2016.